<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">   

    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </h:head>

    <h:body>

        <ui:composition>

            <p:dialog closable="false" showHeader="true" widgetVar="pnDecretoImovel" resizable="false" width="950"
                      maximizable="true" modal="true">
                <f:facet name="header">
                    #{msg.decretoImovelDecretosAssociados}
                </f:facet>
                <p:messages for="modal" closable="true" autoUpdate="true"/>
                <h:form id="fDecretoImovel">

                    <p:outputPanel id="opDecretoImovel">
                        <p:dataTable id="dtDecretoImovel"
                                     value="#{imovelDecreto.imoveisDoDecreto}"
                                     var="imvDC"
                                     paginator="true"
                                     paginatorPosition="bottom"
                                     paginatorAlwaysVisible="false"
                                     rows="#{imovelDecreto.registrosPorPagina}"
                                     rowsPerPageTemplate="#{imovelDecreto.linhasPorPagina}"
                                     emptyMessage="#{msg.nenhumRegistroEncontrado}"
                                     binding="#{imovelDecreto.dataTable}">

                            <p:column headerText="#{msg.decretoImovel}" style="width: 10%">
                                #{imvDC.imovel.numero}
                            </p:column>

                            <p:column headerText="#{msg.decretoImovelBairro}" style="width: 25%">
                                #{imvDC.imovel.bairro}
                            </p:column>

                            <p:column headerText="#{msg.decretoImovelQuadra}" style="width: 10%">
                                #{imvDC.imovel.quadra}
                            </p:column>

                            <p:column headerText="#{msg.decretoImovelLote}" style="width: 10%">
                                #{imvDC.imovel.lote}
                            </p:column>

                            <p:column headerText="#{msg.decretoImovelAlertas}" style="width:5%; text-align: center">
                                <p:commandButton icon="ui-icon-alert" readonly="true"/>
                            </p:column>

                            <p:column headerText="#{msg.decretoImovelAtivosInativos}" style="width: 40%" transient="true">
                                <div style="vertical-align: bottom; width: 100%">
                                    <p:selectBooleanCheckbox id="sbcAtivar" value="#{imvDC.situacao}">
                                        <p:ajax event="change" listener="#{imovelDecreto.atualizarImovelDecreto(imvDC)}" process="@this, dtDecretoImovel" update="dtDecretoImovel"/>
                                    </p:selectBooleanCheckbox>
                                    <p:inputText id="itMotivo" value="#{imvDC.motivo}" size="60">
                                        <p:ajax event="blur" listener="#{imovelDecreto.atualizarImovelDecreto(imvDC)}" process="@this, dtDecretoImovel" update="dtDecretoImovel"/>
                                    </p:inputText>
                                </div>
                            </p:column>

                        </p:dataTable>
                    </p:outputPanel>

                    <div class="espacamento"/>

                    <div align="left">
                        <p:commandButton id="btAddImovel"
                                         icon="ui-icon-plus"
                                         value="#{msg.decretoImovelAdicionarImoveis}"
                                         action="#{imovelDecreto.initPainelSelecaoImoveis}"
                                         oncomplete="pnConsultarImoveis.show();"
                                         style="width: 160px"
                                         update=":fConsultarImoveis"/>
                        <p:spacer width="5"/>
                        <p:commandButton id="btCancelar"
                                         icon="ui-icon-close"
                                         value="#{msg.cancelar}"
                                         immediate="true"
                                         action="#{imovelDecreto.fecharPainelAssociacaoImovelDecreto}"/>
                    </div>
                </h:form>
            </p:dialog>
        </ui:composition>

    </h:body>

</html>
